package org.example.designPattern.behavioral.command;

import java.util.HashMap;
import java.util.Map;

/*
* 键盘
* */
public class Keyboard {
    Map<String, Command> map = new HashMap<>();

    public Keyboard() {
        map.put("shift", new ShiftCommand());
        map.put("2", new ShiftCommand());
        map.put("shift+2", new ShiftAndTwoCommand());
    }

    public void executeCommand(String command){
        Command command1 = map.get(command);
        if(command1!=null){
            command1.execute();
        }
    }
}
